package com.thrc.borrow.service;

import java.util.Date;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.thrc.borrow.dao.SmsDao;
import com.thrc.borrow.entity.SmsRecord;
import com.thrc.borrow.utils.SmsUtil;

@Service
public class SmsService {

	@Resource
	private SmsDao smsDao;

	/**
	 * 1、注册验证码短信提示
	 * 
	 * @throws Exception
	 */
	public void sendCaptchaCodeSms(String mobile, String code, String type) throws Exception {
		String content = "感谢您的注册，请勿向任何人提供验证码信息。验证码：" + code;
		SmsUtil.send(mobile, content);

		SmsRecord record = new SmsRecord();
		record.setCreateTime(new Date());
		record.setPhone(mobile);
		record.setContent(content);
		record.setSmsType(type);

		smsDao.insert(record);
	}

}
